/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
/**
 * File     DAInamiteConstants.java
 * Package  robocup.component
 * Project  Robocup
 * Date     Jan 30, 2005
 * Web      www.dai-labor.de
 * 
 * @author Grzegorz Lehmann
 */
package robocup.component;

import java.lang.reflect.Field;

/**
 * <code>DAInamiteConstants</code> holds all constants used in the team.
 * 
 */
public final class DAInamiteConstants {

	/***************************************************************************
	 * Synchro
	 **************************************************************************/
	// sending after % of a cycle
	// if you encounter many holes -> lower this value
	// if you got a fast machine and a high lateVI == BodySense quote -> raise
	// it
	// max = 1., (depends on server load)
	// currently used only if we expect a VI to arrive in 2nd quarter
	// - otherwise we don't calculate an action after a BS
	public static final double SYNCHRO_SENDING_PERCENTAGE = .8;

	/***************************************************************************
	 * Action
	 **************************************************************************/

	public static final double DRIBBLE_TURN_ANGLE = 30.0;

	/***************************************************************************
	 * Tactics
	 **************************************************************************/

	// stamina
	/**
	 * if stamina is above this value, player moves to strategic position.
	 */
	public final static double STAMINA_THR_MAX = 3900;

	/** 0.9 * STAMINA_MAX */
	public final static double STAMINA_THR_HIGH = 3200;

	/** 0.8 * STAMINA_MAX */
	public final static double STAMINA_THR_MID = 2400;

	/** 0.8 * STAMINA_MAX */
	public final static double STAMINA_THR_MID_LOW = 2400;

	/** 0.7 * STAMINA_MAX */
	public final static double STAMINA_THR_LOW = 1250;

	/***************************************************************************
	 * Worldmodel & factbase
	 **************************************************************************/

	/**
	 * <code>FB_HIST_SIZE_C</code> history size for FactBase of the coach
	 */
	public static final int FB_HIST_SIZE_C = 5;

	/**
	 * <code>DOUBLE_UNKNOWN</code> Unknown value from parser
	 */
	public static final double DOUBLE_UNKNOWN = -999.99;

	/**
	 * <code>WM_MAX_FLAGS</code> maximal flags count for position calculation
	 */
	public static final int WM_MAX_FLAGS = 5;

	/**
	 * <code>WM_V_AGE_CONFIDENCE</code> maximum number of cycles in which we
	 * don't see the ball but still believe to know where it is.
	 */
	public static final int WM_V_AGE_CONFIDENCE = 7;

	/**
	 * <code>WM_FLAG_RADIUS</code> radius around the flags in SConf used in
	 * method SConf.getFlag(Vektor pos). Note that this value mustn't be greater
	 * than 2.5, which is the half of the minimum distance between two flags.
	 */
	public static final double WM_FLAG_RADIUS = 1.;

	/**
	 * The maximum distance, a player should believe the pointto-dircetion of
	 * teammates is reliable - otherwise noise is too large!
	 */
	public static final double MAX_POINT_AT_NOTICE_DIST = 14.0;

	/**
	 * The maximum value, a players stamina is encoded into a pointto
	 */
	public static final double MAX_STAMINA_POINTED = 3200.0;

	/**
	 * The value that makes a players status change due to new stamina knowledge
	 */
	public static final double STAMINA_STATUS_DIFF = 500;

	/**
	 * This is the maximum value, an angle for pointing the stamina is used!
	 */
	public static final double STAMINA_MAX_POINT_ANGLE = 150;

	/** ************* PROPHET ********************************* */

	// maximum amount of cycles analyzed for passing
	public static final int PROPHET_MAX_CYCLES_PASSING = 20;

	// maximum amount of cycles analyzed for ball-interception
	public static final int PROPHET_MAX_CYCLES_INTERCEPTION = 50;

	// maximum amount of cycles, a player should dash backwards 
	// in ball-interception
	public static final int PROPHET_MAX_BACKWARD = 5;

	/***************************************************************************
	 * <code>printConstants</code> prints all WM constants on System.out
	 */
	public static final void printWorldConstants() {

		StringBuffer sBuff = new StringBuffer(200);
		sBuff.append("\nDAI-NAMITE team constants: \n");
		Field[] fields = DAInamiteConstants.class.getFields();
		for (int i = 0; i < fields.length; i++) {
			sBuff.append(fields[i].getName());
			sBuff.append(" =\t");
			try {
				sBuff.append(fields[i].get(null).toString());
			} catch (Exception e) {
				sBuff.append("unknown");
			}
			sBuff.append("\n");
		}
		System.out.println(sBuff.toString());
	}
}
